
# To build modules outside of the kernel tree, we run "make"
# in the kernel source tree; the Makefile these then includes this
# Makefile once again.
# This conditional selects whether we are being included from the
# kernel Makefile or not.

TARGET = test_demo
CROSS_COMPILE = arm-linux-
CC              = $(CROSS_COMPILE)gcc
STRIP           = $(CROSS_COMPILE)strip
#CFLAGS          = -O2


ifeq ($(KERNELRELEASE),)

    # Assume the source tree is where the running kernel was built
    # You should set KERNELDIR in the environment if it's elsewhere
    KERNELDIR ?= /up-techpxa270/kernel/linux-2.6.9
    # The current directory is passed to sub-makes as argument
    PWD := $(shell pwd)

#all:	$(TARGET) modules
all :   modules
$(TARGET):
	$(CC) -o $(TARGET) $(TARGET).c

modules:
	$(MAKE) -C $(KERNELDIR) M=$(PWD) modules

modules_install:
	$(MAKE) -C $(KERNELDIR) M=$(PWD) modules_install

clean:
	rm -rf *.o *~ core .depend .*.cmd *.ko *.mod.c .tmp_versions $(TARGET)

.PHONY: modules modules_install clean

else
    # called from kernel build system: just declare what our modules are
    obj-m := memfifo.o
    memfifo-objs := memfifo-main.o kfifo.o

endif



